<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%-- <%@ include file="/common/links.jsp"%> --%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript"
	src="${ctx}/scripts/jquery-resize/jquery.ba-resize.js"></script>
<script type="text/javascript">
	var gridIdString = "#productInfolist";
	jQuery(document).ready(
			function() {
				grid = jQuery(gridIdString);
				grid.jqGrid({
					url : "productInfoGrid",
					datatype : "json",
					mtype : "GET",
					colModel : [ {
						name : 'productId',
						index : 'productId',
						align : 'center',
						label : '<s:text name="productInfo.productId" />',
						hidden : false,
						key : true
					}, {
						name : 'productName',
						index : 'productName',
						align : 'center',
						label : '<s:text name="productInfo.productName" />',

					}, {
						name : 'disabled',
						index : 'disabled',
						align : 'center',
						label : '<s:text name="productInfo.disabled" />',
						formatter :"checkbox"

					} ],

					jsonReader : {
						root : "pageList", // (2)
						page : "page",
						total : "total",
						records : "records", // (3)
						repeatitems : false
					},

					prmNames : {
						page : "page",
						rows : "pagesize",
						sort : "sortname",
						order : "sortorder"
					},
					rowNum : 10,
					rowList : [ 5, 10, 20, 50, 100, 200 ],
					pager : '#productInfopager',
					rownumbers : true,
					sortname : 'productId',
					sortorder : 'desc',
					caption : '<s:text name="productInfoList.title" />',
					height : "900",
					autowidth : true,
					shrinkToFit:false,
					loadui : "disable",
					multiselect : true,
					multiboxonly : true,
					hidegrid : true,
					gridComplete : function() {
						if (jQuery(this).getDataIDs().length > 0) {
							jQuery(this).jqGrid('setSelection',
									jQuery(this).getDataIDs()[0]);//默认选中第一行
						}
					},
					loadComplete : function(data) {
						resizeJqGrid($(this));
						if (data.ajaxStatus === "error")
							alertMsg.error(data.ajaxMessage);

					},
					loadError : function(xhr, st, err) {
						//jQuery("#rsperror").html("Type: "+st+"; Response: "+ xhr.status + " "+xhr.statusText);
						alertMsg.error("Type: " + st + "; Response: "
								+ xhr.status + " " + xhr.statusText);
					}

				});

				jQuery(grid).jqGrid('navGrid', '#productInfopager', {
					edit : false,
					add : false,
					del : false,
					search : false,
					excel : false
				}, {}, {}, {}, {
					multipleSearch : false,
					multipleGroup : false
				});
				/* $(".pageContent").bind("resize", function() {
					resizeGrid($("#productInfolist"), 25,null);
				}); */
			});

	function addProductInfo(){

		var url = "addProductInfo";
		var winTitle='<s:text name="productInfoNew.title" />';
		url = encodeURI(url);
		$.pdialog.open(url, 'addProductInfo', winTitle, {mask:false,width:880,height:600});　
	}
	function editProductInfo(){
		var sid = jQuery("#productInfolist").jqGrid('getGridParam','selrow');
		var url = "editProductInfo?id="+sid;
		var winTitle='<s:text name="productInfoEdit.title" />';
		url = encodeURI(url);
		$.pdialog.open(url, 'editProductInfo', winTitle, {mask:false,width:880,height:600});　
	}


</script>
</head>
<body>
	<div class="page">
			<div class="panelBar">
				<ul class="toolBar">
					<li><a class="add" href="#"
						onclick="javaScript:addProductInfo();"><span>添加</span></a></li>
					<li class="line">line</li>
					<li><a class="delete" href="#"
						onclick="javaScript:processGridSelectedRecords('productInfolist','deleteProductInfo','确认删除吗?');"><span>删除</span></a></li>
					<li class="line">line</li>
					<li><a class="edit" href="#"
						onclick="javaScript:editProductInfo();"><span>修改</span></a></li>
					<li class="line">line</li>
					<li><a class="icon" href="#"
						onclick="javaScript:processGridSelectedRecords('productInfolist','disableProductInfo','确认停用吗?');"><span>停用</span></a></li>
					<li class="line">line</li>
					<li><a class="icon" href="#"
						onclick="javaScript:processGridSelectedRecords('productInfolist','enableProductInfo','确认启用吗?');"><span>启用</span></a></li>
				</ul>
			</div>
		<div class="pageContent" layoutH="0">
			<table id="productInfolist"></table>
			<div id="productInfopager"></div>
		</div>
	</div>
	<!-- 	<div class="panelBar"></div> -->
</body>
</html>